﻿using System;
class WorkDeysBetweenDates
{
    static int InputNumber(int fromValue, int toValue)
    {
        int number = 0;
        do
        {
            if (number != 0)
            {
                Console.Write("number must be between {0} and {1}. reenter: ", fromValue, toValue);
            }
            while (true)
            {
                try
                {
                    number = int.Parse(Console.ReadLine());
                    break;
                }
                catch (FormatException)
                {
                    Console.Write("reenter number. not in wanted format: ");
                }
                catch (OverflowException)
                {
                    Console.WriteLine("overflow");
                }
            }
        } while ((number < fromValue) || (number > toValue));
        return number;
    }
    static void Main()
    {


        Console.Write("please input day: ");
        int day = InputNumber(1, 31);
        Console.Write("please input month: ");
        int month = InputNumber(1, 12);
        Console.Write("please input year: ");
        int year = InputNumber(2013, int.MaxValue);
        Console.WriteLine(DateTime.Now.Day);
        Console.WriteLine(DateTime.Now.Month);
        Console.WriteLine(DateTime.Now.Year);
        Console.ReadLine();


    }
}

